import Vue from 'vue'
import VueRouter from 'vue-router'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)
const router = new VueRouter({
	routes: [
		{
            name:'首页',
            path:"/",
            component: () => import('@/view/main'),
            children:[
                {
                    path:"/",
					redirect:'/index'
                },
                {
                    name:'index',//首页
                    path:'index',
                    component:()=>import('@/view/index/index'),
                    meta:{
                        title:'挂号',
                    }
                },
                {
                    name:'core',//个人中心
                    path:'core',
                    component:()=>import('@/view/core/core'),
                    meta:{
                        title:'个人中心',
                    }
                }
            ]
        },
		{
			name:'login',
			path: '/login',//登录
			component: () => import("@/view/login/login"),
			meta:{
				title:'登录',
				anonymous:true//匿名访问的页面
			}
		}


	]
})

export default router